<?php include_once 'common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once 'common/account_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
		<div class="admin_right_title">
		<strong>资金管理</strong> &gt;&gt; 账户信息
		</div>
		
		<div class="admin_right_con">
			<table border="0" cellspacing="1" cellpadding="0">
			  <tr style="color:#0068b7;">
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>编号</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>用户名</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>姓名</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>类型</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>银行</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>地区</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>开户行</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>提现帐号</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong id="ze_rank" style="cursor:pointer;" >总额<span class="<?php echo  $id_num == 1 && $order_num == 2 ? 'arrow-down' : 'arrow-up'?>"></span></strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong id="ky_rank" style="cursor:pointer;">可用<span class="<?php echo  $id_num == 2 && $order_num == 2 ? 'arrow-down' : 'arrow-up'?>"></span></strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong id="dj_rank" style="cursor:pointer;">冻结<span class="<?php echo  $id_num == 3 && $order_num == 2 ? 'arrow-down' : 'arrow-up'?>"></span></strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong id="ds_rank" style="cursor:pointer;">代收<span class="<?php echo  $id_num == 4 && $order_num == 2 ? 'arrow-down' : 'arrow-up'?>"></span></strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>操作</strong></td>
			  </tr>
			  <?php foreach($account_list as $key=>$account){?>
			  <tr>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $account['user_id'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><a href="javascript:showUser(<?php echo $account['user_id'];?>);"><?php echo $account['username'];?></a></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $account['realname'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $user_loan[$account['is_loan']];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo @$account_bank[$account['bank']];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $account['province']?$area_list[$account['province']]:'';?> | <?php echo $account['city']?$area_list[$account['city']]:'';?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $account['branch'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $account['account'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($account['total'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($account['use_money'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($account['no_use_money'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($account['collection'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><a href="/ychadmin/account/account_bank/<?php echo $account['user_id'];?>">修改银行账号</a></td>
			  </tr>
			  <?php }?>
			  <tr>
			  	<td colspan="13" height="35" align="left" valign="middle" bgcolor="#FFFFFF">
			  		<form action="/ychadmin/account/accountlist/" method="get">
			  			用户名：<input type="text" id="username" name="username" style="width: 100px;" value="<?php echo $username?>" />
			  			实名：<input type="text" id="realname" name="realname" style="width: 100px;" value="<?php echo $realname;?>" />
			  			时间：<input type="text" id="endtime" name="endtime" style="width: 100px;" value="<?php echo $endtime;?>"  onfocus="WdatePicker()" />
			  			类型：<select id="is_loan" name="is_loan">
			  				<option value="-1" <?php if($is_loan==-1){?>selected="selected"<?php }?>>所有</option>
			  				<?php foreach($var_user_loan as $key=>$value){?>
			  				<option value="<?php echo $key?>" <?php if($is_loan==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
			  				<?php }?>
			  			</select>
			  			是否内部账号：<select id="is_self" name="is_self">
			  				<option value="-1" <?php if($is_self==-1){?>selected="selected"<?php }?>>所有</option>
			  				<?php foreach($user_self as $key=>$value){?>
			  				<option value="<?php echo $key?>" <?php if($is_self==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
			  				<?php }?>
			  			</select>
			  			<input type="submit" value="查询" />
			  		</form>
			  		<a href="/ychadmin/account/accountexcel/?username=<?php echo $username;?>&realname=<?php echo $realname;?>&endtime=<?php echo $endtime;?>&is_loan=<?php echo $is_loan;?>&is_self=<?php echo $is_self?>">导出数据</a>
			  	</td>
			  </tr>
			  <tr>
			  	<td  bgcolor="#FFFFFF"><font style="color:red;">可用金额的总额为:<?php echo $account_total?>元</font></td>
			  	<td colspan="12"  height="35" align="center" valign="middle" bgcolor="#FFFFFF" class="page"><?php echo $this->pagination->create_links();?></td>
			  </tr>
			</table>
			</div>
	</div>
<!-- Admin_Right End -->
</div>
<div id="dialog" title="用户信息" style="display:none">
	<div id="view_response"></div>
</div>
<script>
function showUser(user_id){
	$.ajax({
		type: "POST",
		url: "/ychadmin/user/showDetailInfo",
		data: "user_id="+user_id,
		success: function(ret){
				$('#dialog').dialog({
					width:650,
					height:600,
					title:'用户信息',
					buttons:{"确定":function(){$(this).dialog("close");}},
				}); 
				$("#view_response").html(ret);
			
		},
		dataType: "text"
	});
}
	
	$("#ze_rank").click(function(){
		//delete_span_class('ze_rank');
		update_span_style('ze_rank');
	});       
	$("#ky_rank").click(function(){
		//delete_span_class('ky_rank');
		update_span_style('ky_rank');
	});
	$("#dj_rank").click(function(){
		//delete_span_class('dj_rank');
		update_span_style('dj_rank');
	});
	$("#ds_rank").click(function(){
		//delete_span_class('ds_rank');
		update_span_style('ds_rank');
	});

	function update_span_style(idval) {
		var ids = idval;
		$ze_s_class = $("#"+ids+" span").attr("class");
		switch($ze_s_class){
			case 'arrow-down':
				window.location.href = '/ychadmin/account/accountlist/?'+ids+'=desc';
				$("#"+ids+" span").attr("class","arrow-up");
			break;
			case 'arrow-up':
				window.location.href = '/ychadmin/account/accountlist/?'+ids+'=asc';
				$("#"+ids+" span").attr("class","arrow-down");
			break;
		}
	}

	function delete_span_class(idval) {
		var idvals = new Array('ze_rank','ky_rank','dj_rank','ds_rank');
		var idlens = idvals.length;
		var ids = idval;
		for(var i=0;i<idlens;++i) {
			if(idvals[i] != ids) {
				$("#"+idvals[i]+" span").attr("class","arrow-down");
			}
		}
	}
</script>

<!-- admin_main end -->
</body>
</html>
